<template>
  <div class="box">
    <el-menu
      class="el-menu-vertical"
      unique-opened
      :default-openeds="defaultOpeneds"
      :default-active="defaultActive"
      background-color="#2b4b6b"
      text-color="#fff"
      router
      active-text-color="#ffd04b">
      <el-submenu :index="item.id" v-for="(item,i) in menuList" :key="i">
        <template slot="title">
          <div class="menu-item-title">
            <i :class="item.icon" style="color: #ffffff"></i>
            <span>{{ item.name }}</span>
          </div>
        </template>
        <el-menu-item :index="itemChild.path" v-for="(itemChild,i) in item.child"
                      :key="i" style="width: 170px">
          <div class="menu-item-title">
            <i class="el-icon-menu" style="color: #ffffff"></i>
            {{ itemChild.name }}
          </div>
        </el-menu-item>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
import { menuList } from '@/util/menuUtil'

export default {
  name: 'MenuAside',
  data () {
    return {
      menuList: menuList(),
      defaultOpeneds: ['1'],
      defaultActive: '/datashow'
    }
  }
}
</script>

<style lang="less" scoped>

.box {
  width: 100%;
}

.el-menu-vertical {
  border-right: solid 0 #ffffff;
}

.el-submenu .el-menu-item {
  min-width: 0;
}

.menu-item-title {
  display: flex;
  align-items: center;
}

</style>
